<!-- 组件1 -->
<template>
  <div class="monthly-tab1">
    <div class="list-item" v-for="(item, index) in dataList" :key="index">
      <div class="lf">
        <img :src="icon" alt="" srcset="" />
        <div class="detail">
          <div class="magrinbt5">{{ item.title }}</div>
          <div>{{ item.number }}</div>
        </div>
      </div>
      <div class="rg">
        <div>
          <div class="magrinbt5">比上月</div>
          <div :class="item.monthLift === 1 ? 'down' : 'up'">
            <span v-show="item.monthLift === 1">↑</span>
            <span v-show="item.monthLift === 0">↓</span>
            <span class="than">{{ item.thanMonth }}</span>
          </div>
        </div>
        <div>
          <div class="magrinbt5">比去年</div>
          <div :class="item.yearLift === 1 ? 'down' : 'up'">
            <span v-show="item.yearLift === 1">↑</span>
            <span v-show="item.yearLift === 0">↓</span>
            <span class="than">{{ item.thanYear }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { reactive, toRefs, onBeforeMount, onMounted, getCurrentInstance } from "vue";
export default {
  name: "",
  setup() {
    const data = reactive({
      icon: require("../../../assets/images/analysis/gongzi.png"),
      dataList: [],
    });
    const { proxy } = getCurrentInstance();
    onBeforeMount(() => {});
    onMounted(() => {
      proxy.$api.getMonthlyHrSource().then((res) => {
        data.dataList = res.obj;
      });
    });
    const refData = toRefs(data);
    return {
      ...refData,
    };
  },
};
</script>
<style scoped lang="scss">
.list-item {
  background-color: #fff;
  display: flex;
  justify-content: space-around;
  padding: 15px 0;
  margin: 10px;
  .lf {
    flex: 1;
    display: flex;
    justify-content: space-around;
    img {
      width: 40px;
      height: 40px;
    }
    .detail {
      margin-right: 10px;
    }
  }
  .rg {
    flex: 1;
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 12px;
  }
  .than {
    margin-left: 3px;
  }
}
</style>
